Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

demos: automate running demos and update them #2231

Merged
merged 9 commits into from
Oct 4, 2023
Merged

Conversation

ilyagr
Copy link
Collaborator

@ilyagr ilyagr commented Sep 8, 2023

The shell scripts here are a bit messy, but are quite functional for me.

The PR also includes some changes to the demos to make them flow better (IMO), given
the intervening changes to jj output.

The font that ended up being used seems to take up more space than the font we had
previously. I also find it more readable, and it could take some effort to experiment
with different fonts.

The scripts also generate SVGs. It would be very cheap to store them in the repo, but we could also remove them. The pro of SVGs is that they are perfectly crisp, and the con is that some of the curves and postioning in jj log's Unicode are slightly off (in my browser, this depends on what fonts you have installed).

Here's what the README looks like with these changes.

TODO:

@ilyagr ilyagr changed the title demos: automate them, generate svgs as well demos: automate running demos, generate svgs as well Sep 8, 2023
@ilyagr ilyagr changed the title demos: automate running demos, generate svgs as well demos: automate running demos Sep 8, 2023
@ilyagr ilyagr force-pushed the runscript branch 2 times, most recently from 75bf460 to a87b949 Compare September 8, 2023 07:13
@necauqua
Copy link
Collaborator

necauqua commented Sep 8, 2023

I think you could reference some external, like a google one or something, it would be stable (and probably would fall back to system font in unlikely case github is accessible and google cdn is not?).

Ideally there could be some svg processor to convert text to paths so that it's a stable drawing and does not depend on anything.

@ilyagr
Copy link
Collaborator Author

ilyagr commented Sep 8, 2023

@necauqua This would be great, but after spending some time on it, I couldn't find a good way to do it. No Google font seems to support all these symbols.

A simpler problem to solve would be to make the graphs at https://martinvonz.github.io/jj/prerelease/tutorial.html#the-operation-log look equally good on all computers. It looks good on my Linux computer, but not on my Chromebook1, in a way that seems very similar to SVGs. It's easy to switch the "MkDocs Material" theme to use any Google Font there, but no choice seemed to help.

If we could solve that, maybe we could solve the SVG issue in the same way.

There's some more discussion of related issues in #1467 and https://github.com/slowli/term-transcript/issues?q=is%3Aissue+author%3Ailyagr (both open and closed, there might also be something interesting in issues that aren't mine).

Footnotes

  1. The fact that I don't know how to detect, let alone debug, this issue on a single given computer makes this extra-fun.

@ilyagr
Copy link
Collaborator Author

ilyagr commented Sep 9, 2023

Oh, and re converting text to paths: that works with Inkscape, but the result seems to be as big as the png file, more or less (though maybe it compresses better?), and certainly the diffs stop being human readable.

@ilyagr
Copy link
Collaborator Author

ilyagr commented Sep 10, 2023

@necauqua , I discovered a weird thing about Google fonts. If you follow this link, it seems like some monospace fonts do support all the symbols we need. However, if you click through to those fonts, they no longer seem to support the relevant symbols. Moreover, they didn't work when I experimented with changing the font for documentation website theme's code block font.

The webfont world seems dark and mysterious.

@ilyagr ilyagr force-pushed the runscript branch 10 times, most recently from 20cd7c3 to 130cae6 Compare September 10, 2023 05:02
@ilyagr ilyagr changed the title demos: automate running demos demos: automate running demos and update them Sep 10, 2023
@ilyagr ilyagr force-pushed the runscript branch 8 times, most recently from e380d32 to e7780b2 Compare September 10, 2023 06:07
demos/operation_log.png Outdated Show resolved Hide resolved
demos/demo_operation_log.sh Outdated Show resolved Hide resolved
demos/demo_operation_log.sh Outdated Show resolved Hide resolved
@martinvonz
Copy link
Member

Feel free to merge this as is, with or without the unused function for ignoring exit code 3. Thanks again for working on this!

demos/resolve_conflicts.png Outdated Show resolved Hide resolved
@ilyagr ilyagr force-pushed the runscript branch 7 times, most recently from cb01998 to fbdddcb Compare October 4, 2023 00:56
@ilyagr
Copy link
Collaborator Author

ilyagr commented Oct 4, 2023

I think this is hopefully the final version. I'll look it over before merging.

In other news, it seems that without installing Inkscape, PNG generation didn't work properly on Debian Linux. I'm not sure whether ImageMagick uses Inkscape itself or one of its dependencies.

ilyagr added 3 commits October 3, 2023 18:08
I think it's clearer if only the actual demos started with `demo_`,
so I renamed `demo_helpers.sh` to just `helpers.sh`.

`demo_resolve_conflict.sh` should match `resolve_conflicts.png` (with an s).
Previously, we needed to remove this manually from screenshots.
`jj | head` exits with non-zero code since `head` breaks the
pipe. Also, removed `--color=always` from that command as it
will shortly become unnecessary.

Previosly, this caused the script to stop since it's run with
`set -o pipefail`.

Also, the operation id recovery code stopped working. We
can use `jj debug operation` for this purpose now.
…ript

Currently, there is no way provided to merely run scripts in
a fixed environment (without recording).

Short-term TODOs (done in descendant commits):
  - Fix the terminal width
  - Document the script
ilyagr added 5 commits October 3, 2023 20:17
Previously, `jj` couldn't determine the terminal widths inside demos.
PNGs are updated in a descendant commit
This is mainly to account for the fact that most commands now report
more information about the state of the repo.
We remove some branches that would be shown by default and
remove `-r 'all()'` where it's no longer necessary.
The changes to SVGs would be trivial, so they got
pushed to the previous commit.
@ilyagr ilyagr merged commit 6671971 into jj-vcs:main Oct 4, 2023
15 checks passed
@ilyagr ilyagr deleted the runscript branch October 4, 2023 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants